import os, geopandas as gpd
countries=gpd.read_file(os.path.join("https://github.com/RenzoJSC/introgeodf/raw/refs/heads/main/maps/World_Countries/World_Countries.shp"))
rivers=gpd.read_file(os.path.join("https://github.com/RenzoJSC/introgeodf/raw/refs/heads/main/maps/World_Hydrography/World_Hydrography.shp"))
cities=gpd.read_file(os.path.join("https://github.com/RenzoJSC/introgeodf/raw/refs/heads/main/maps/World_Cities/World_Cities.shp"))
australia=countries[countries.COUNTRY=='Australia']
australia.plot()
centroid=australia.centroid
<ipython-input-377-c393dd202630>:3: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation. centroid=australia.centroid
australia_3112=australia.to_crs(3112)
base3112=australia_3112.plot()
australia_3112.centroid.plot(ax=base3112, marker='*', color='red', markersize=20)
<Axes: >
australia_3112.centroid
| 0 | |
|---|---|
| 11 | POINT (32199.226 -2924192.688) |
# 1. Ensure 'cities' GeoDataFrame is in the same CRS as 'australia_3112' (EPSG:3112)
cities_3112 = cities.to_crs(3112)
# 2. Use spatial join to select cities within Australia's boundaries
australia_cities = gpd.sjoin(cities_3112, australia_3112, how='inner', predicate='intersects')
# 3. Now you can plot the cities located within Australia
australia_cities.plot(ax=base3112, marker='o', color='blue', markersize=5)
<Axes: >
Graficar ciudades encima del mapa usando base
citiesAustralia_clipped = gpd.clip(gdf=cities,
mask=australia) #todas las ciudades dentro del polígonos australia. No es intersección. Solo me quedo con ciudades
riversAustralia_clipped = gpd.clip(gdf=rivers,
mask=australia)
base = australia.plot(facecolor="greenyellow", edgecolor='black', linewidth=0.4,figsize=(5,5))
citiesAustralia_clipped.plot(marker='+', color='red', markersize=15,
ax=base)
riversAustralia_clipped.plot(edgecolor='blue', linewidth=0.5,
ax=base)
<Axes: >
base = australia.plot(facecolor="greenyellow", edgecolor='black', linewidth=0.4,figsize=(5,5))
citiesAustralia_clipped.cx[:32199.226,:-2924192.688].plot(ax=base)
#Ciudades debajo del centroide
<Axes: >
Ejercicio 1. Parte 2: Plot your country as the background. Select with cx all the first administrative divisions above the centroid. Then, use clip to show the rivers that cross those divisions.
base = australia.plot(facecolor="greenyellow", edgecolor='black', linewidth=0.4,figsize=(5,5))
australia_states=gpd.read_file("https://github.com/valcc01/Trabajo-grupal-2/raw/refs/heads/main/SUBNATIONAL/STE_2021_AUST_SHP_GDA2020/STE_2021_AUST_GDA2020.shp")
import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(ncols=2, sharex=False, sharey=False, figsize=(12,12))
australia_states.plot(ax=ax1, facecolor='lightgrey', edgecolor='black')
<Axes: >
base = australia.plot(facecolor="white", edgecolor='black', linewidth=0.4,figsize=(5,5))
australia_states.cx[:32199.226,:-2924192.688].plot(ax=base)
<Axes: >
Create some subset of polygons with your country data at the municipal (or similar level). Use Unary UNION with those polygons, and create a geoDF with the result.
#!pip install fiona
LinkAustralia="https://github.com/valcc01/Trabajo-grupal-2/raw/refs/heads/main/GEODATA/australiaMaps_3112%20(2)%20(2).gpkg"
import geopandas as gpd
from fiona import listlayers
listlayers(LinkAustralia)
['country', 'cities', 'rivers', 'airports']
australia_municipalities=gpd.read_file("https://github.com/valcc01/Trabajo-grupal-2/raw/refs/heads/main/SUBNATIONAL/SA2_2021_AUST_SHP_GDA2020/SA2_2021_AUST_GDA2020.shp")
australia_municipalities.plot(facecolor='lightgrey', edgecolor='black',linewidth=0.2)
<Axes: >
australia_municipalities.head()
| SA2_CODE21 | SA2_NAME21 | CHG_FLAG21 | CHG_LBL21 | SA3_CODE21 | SA3_NAME21 | SA4_CODE21 | SA4_NAME21 | GCC_CODE21 | GCC_NAME21 | STE_CODE21 | STE_NAME21 | AUS_CODE21 | AUS_NAME21 | AREASQKM21 | LOCI_URI21 | geometry | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 101021007 | Braidwood | 0 | No change | 10102 | Queanbeyan | 101 | Capital Region | 1RNSW | Rest of NSW | 1 | New South Wales | AUS | Australia | 3418.3525 | http://linked.data.gov.au/dataset/asgsed3/SA2/... | POLYGON ((149.58424 -35.44426, 149.58444 -35.4... |
| 1 | 101021008 | Karabar | 0 | No change | 10102 | Queanbeyan | 101 | Capital Region | 1RNSW | Rest of NSW | 1 | New South Wales | AUS | Australia | 6.9825 | http://linked.data.gov.au/dataset/asgsed3/SA2/... | POLYGON ((149.21899 -35.36738, 149.218 -35.366... |
| 2 | 101021009 | Queanbeyan | 0 | No change | 10102 | Queanbeyan | 101 | Capital Region | 1RNSW | Rest of NSW | 1 | New South Wales | AUS | Australia | 4.7620 | http://linked.data.gov.au/dataset/asgsed3/SA2/... | POLYGON ((149.21326 -35.34325, 149.21619 -35.3... |
| 3 | 101021010 | Queanbeyan - East | 0 | No change | 10102 | Queanbeyan | 101 | Capital Region | 1RNSW | Rest of NSW | 1 | New South Wales | AUS | Australia | 13.0032 | http://linked.data.gov.au/dataset/asgsed3/SA2/... | POLYGON ((149.24034 -35.34781, 149.24024 -35.3... |
| 4 | 101021012 | Queanbeyan West - Jerrabomberra | 0 | No change | 10102 | Queanbeyan | 101 | Capital Region | 1RNSW | Rest of NSW | 1 | New South Wales | AUS | Australia | 13.6748 | http://linked.data.gov.au/dataset/asgsed3/SA2/... | POLYGON ((149.19572 -35.36126, 149.1997 -35.35... |
len(australia_municipalities.SA4_NAME21) #número de regiones
2473
len(set(australia_municipalities.GCC_NAME21)) #de municipalidades
35
australia_municipalities[australia_municipalities.GCC_NAME21=='Greater Sydney'].plot()
<Axes: >
australia_municipalities[australia_municipalities.GCC_NAME21=='Greater Sydney'].union_all() #pegó todos los distritos por separado, creando la región.
GreatersSydney_union=australia_municipalities[australia_municipalities.GCC_NAME21=='Greater Sydney'].union_all()
type(GreatersSydney_union)
shapely.geometry.multipolygon.MultiPolygon
gpd.GeoDataFrame(index=[0],data={'GCM':'Greater Sydney'}, #se transforma de shapely a geodataframe
crs=australia_municipalities.crs,
geometry=[GreatersSydney_union])
| GCM | geometry | |
|---|---|---|
| 0 | Greater Sydney | MULTIPOLYGON (((150.54892 -34.27617, 150.54886... |
australia_municipalities[australia_municipalities.GCC_NAME21=='Greater Sydney'].dissolve().plot()
<Axes: >
GreaterSydney_dissolve=australia_municipalities[australia_municipalities.GCC_NAME21=='Greater Sydney'].dissolve()
type(GreaterSydney_dissolve)
geopandas.geodataframe.GeoDataFrame
def __init__(data=None, *args, geometry=None, crs=None, **kwargs)
A GeoDataFrame object is a pandas.DataFrame that has one or more columns containing geometry. In addition to the standard DataFrame constructor arguments, GeoDataFrame also accepts the following keyword arguments: Parameters ---------- crs : value (optional) Coordinate Reference System of the geometry objects. Can be anything accepted by :meth:`pyproj.CRS.from_user_input() <pyproj.crs.CRS.from_user_input>`, such as an authority string (eg "EPSG:4326") or a WKT string. geometry : str or array-like (optional) Value to use as the active geometry column. If str, treated as column name to use. If array-like, it will be added as new column named 'geometry' on the GeoDataFrame and set as the active geometry column. Note that if ``geometry`` is a (Geo)Series with a name, the name will not be used, a column named "geometry" will still be added. To preserve the name, you can use :meth:`~GeoDataFrame.rename_geometry` to update the geometry column name. Examples -------- Constructing GeoDataFrame from a dictionary. >>> from shapely.geometry import Point >>> d = {'col1': ['name1', 'name2'], 'geometry': [Point(1, 2), Point(2, 1)]} >>> gdf = geopandas.GeoDataFrame(d, crs="EPSG:4326") >>> gdf col1 geometry 0 name1 POINT (1 2) 1 name2 POINT (2 1) Notice that the inferred dtype of 'geometry' columns is geometry. >>> gdf.dtypes col1 object geometry geometry dtype: object Constructing GeoDataFrame from a pandas DataFrame with a column of WKT geometries: >>> import pandas as pd >>> d = {'col1': ['name1', 'name2'], 'wkt': ['POINT (1 2)', 'POINT (2 1)']} >>> df = pd.DataFrame(d) >>> gs = geopandas.GeoSeries.from_wkt(df['wkt']) >>> gdf = geopandas.GeoDataFrame(df, geometry=gs, crs="EPSG:4326") >>> gdf col1 wkt geometry 0 name1 POINT (1 2) POINT (1 2) 1 name2 POINT (2 1) POINT (2 1) See also -------- GeoSeries : Series object designed to store shapely geometry objects
GreaterSydney_dissolve
| geometry | SA2_CODE21 | SA2_NAME21 | CHG_FLAG21 | CHG_LBL21 | SA3_CODE21 | SA3_NAME21 | SA4_CODE21 | SA4_NAME21 | GCC_CODE21 | GCC_NAME21 | STE_CODE21 | STE_NAME21 | AUS_CODE21 | AUS_NAME21 | AREASQKM21 | LOCI_URI21 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | MULTIPOLYGON (((150.54892 -34.27617, 150.54886... | 102011028 | Avoca Beach - Copacabana | 0 | No change | 10201 | Gosford | 102 | Central Coast | 1GSYD | Greater Sydney | 1 | New South Wales | AUS | Australia | 6.4376 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
GreaterSydney_dissolve.drop(columns=['STE_CODE21','STE_NAME21','AREASQKM21','LOCI_URI21','CHG_LBL21','CHG_FLAG21'],inplace=True)
GreaterSydney_dissolve
| geometry | SA2_CODE21 | SA2_NAME21 | SA3_CODE21 | SA3_NAME21 | SA4_CODE21 | SA4_NAME21 | GCC_CODE21 | GCC_NAME21 | AUS_CODE21 | AUS_NAME21 | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | MULTIPOLYGON (((150.54892 -34.27617, 150.54886... | 102011028 | Avoca Beach - Copacabana | 10201 | Gosford | 102 | Central Coast | 1GSYD | Greater Sydney | AUS | Australia |
australia_municipalities.dissolve(by='GCC_NAME21').plot(facecolor='pink', edgecolor='black',linewidth=0.2) #ha agrugapo a todas las municipalidad por su región (región administrativa más grande)
<Axes: >
Australia_adm1_diss=australia_municipalities.dissolve(by='GCC_NAME21')
Australia_adm1_diss
/usr/local/lib/python3.10/dist-packages/geopandas/geoseries.py:860: UserWarning: GeoSeries.notna() previously returned False for both missing (None) and empty geometries. Now, it only returns False for missing values. Since the calling GeoSeries contains empty geometries, the result has changed compared to previous versions of GeoPandas.
Given a GeoSeries 's', you can use '~s.is_empty & s.notna()' to get back the old behaviour.
To further ignore this warning, you can do:
import warnings; warnings.filterwarnings('ignore', 'GeoSeries.notna', UserWarning)
return self.notna()
| geometry | SA2_CODE21 | SA2_NAME21 | CHG_FLAG21 | CHG_LBL21 | SA3_CODE21 | SA3_NAME21 | SA4_CODE21 | SA4_NAME21 | GCC_CODE21 | STE_CODE21 | STE_NAME21 | AUS_CODE21 | AUS_NAME21 | AREASQKM21 | LOCI_URI21 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GCC_NAME21 | ||||||||||||||||
| Australian Capital Territory | POLYGON ((148.80502 -35.36746, 148.80573 -35.3... | 801011001 | Aranda | 0 | No change | 80101 | Belconnen | 801 | Australian Capital Territory | 8ACTE | 8 | Australian Capital Territory | AUS | Australia | 1.5631 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Greater Adelaide | MULTIPOLYGON (((138.46144 -35.25796, 138.46144... | 401011001 | Adelaide | 0 | No change | 40101 | Adelaide City | 401 | Adelaide - Central and Hills | 4GADE | 4 | South Australia | AUS | Australia | 10.4824 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Greater Brisbane | MULTIPOLYGON (((153.08582 -27.93512, 153.08648... | 301011001 | Alexandra Hills | 0 | No change | 30101 | Capalaba | 301 | Brisbane - East | 3GBRI | 3 | Queensland | AUS | Australia | 13.6312 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Greater Darwin | MULTIPOLYGON (((130.8776 -12.55739, 130.87726 ... | 701011001 | Darwin Airport | 0 | No change | 70101 | Darwin City | 701 | Darwin | 7GDAR | 7 | Northern Territory | AUS | Australia | 14.3244 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Greater Hobart | MULTIPOLYGON (((147.03234 -42.77855, 147.03144... | 601011001 | Bridgewater - Gagebrook | 0 | No change | 60101 | Brighton | 601 | Hobart | 6GHOB | 6 | Tasmania | AUS | Australia | 55.7463 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Greater Melbourne | MULTIPOLYGON (((144.75006 -38.36249, 144.74998... | 206011106 | Brunswick East | 0 | No change | 20601 | Brunswick - Coburg | 206 | Melbourne - Inner | 2GMEL | 2 | Victoria | AUS | Australia | 2.1682 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Greater Perth | MULTIPOLYGON (((115.622 -32.62424, 115.62272 -... | 502011021 | Dawesville - Bouvard | 0 | No change | 50201 | Mandurah | 502 | Mandurah | 5GPER | 5 | Western Australia | AUS | Australia | 97.9248 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Greater Sydney | MULTIPOLYGON (((150.54892 -34.27617, 150.54886... | 102011028 | Avoca Beach - Copacabana | 0 | No change | 10201 | Gosford | 102 | Central Coast | 1GSYD | 1 | New South Wales | AUS | Australia | 6.4376 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (ACT) | GEOMETRYCOLLECTION EMPTY | 897979799 | Migratory - Offshore - Shipping (ACT) | 0 | No change | 89797 | Migratory - Offshore - Shipping (ACT) | 897 | Migratory - Offshore - Shipping (ACT) | 89799 | 8 | Australian Capital Territory | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (NSW) | GEOMETRYCOLLECTION EMPTY | 197979799 | Migratory - Offshore - Shipping (NSW) | 0 | No change | 19797 | Migratory - Offshore - Shipping (NSW) | 197 | Migratory - Offshore - Shipping (NSW) | 19799 | 1 | New South Wales | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (NT) | GEOMETRYCOLLECTION EMPTY | 797979799 | Migratory - Offshore - Shipping (NT) | 0 | No change | 79797 | Migratory - Offshore - Shipping (NT) | 797 | Migratory - Offshore - Shipping (NT) | 79799 | 7 | Northern Territory | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (OT) | GEOMETRYCOLLECTION EMPTY | 997979799 | Migratory - Offshore - Shipping (OT) | 0 | No change | 99797 | Migratory - Offshore - Shipping (OT) | 997 | Migratory - Offshore - Shipping (OT) | 99799 | 9 | Other Territories | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (Qld) | GEOMETRYCOLLECTION EMPTY | 397979799 | Migratory - Offshore - Shipping (Qld) | 0 | No change | 39797 | Migratory - Offshore - Shipping (Qld) | 397 | Migratory - Offshore - Shipping (Qld) | 39799 | 3 | Queensland | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (SA) | GEOMETRYCOLLECTION EMPTY | 497979799 | Migratory - Offshore - Shipping (SA) | 0 | No change | 49797 | Migratory - Offshore - Shipping (SA) | 497 | Migratory - Offshore - Shipping (SA) | 49799 | 4 | South Australia | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (Tas.) | GEOMETRYCOLLECTION EMPTY | 697979799 | Migratory - Offshore - Shipping (Tas.) | 0 | No change | 69797 | Migratory - Offshore - Shipping (Tas.) | 697 | Migratory - Offshore - Shipping (Tas.) | 69799 | 6 | Tasmania | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (Vic.) | GEOMETRYCOLLECTION EMPTY | 297979799 | Migratory - Offshore - Shipping (Vic.) | 0 | No change | 29797 | Migratory - Offshore - Shipping (Vic.) | 297 | Migratory - Offshore - Shipping (Vic.) | 29799 | 2 | Victoria | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Migratory - Offshore - Shipping (WA) | GEOMETRYCOLLECTION EMPTY | 597979799 | Migratory - Offshore - Shipping (WA) | 0 | No change | 59797 | Migratory - Offshore - Shipping (WA) | 597 | Migratory - Offshore - Shipping (WA) | 59799 | 5 | Western Australia | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (ACT) | GEOMETRYCOLLECTION EMPTY | 899999499 | No usual address (ACT) | 0 | No change | 89999 | No usual address (ACT) | 899 | No usual address (ACT) | 89499 | 8 | Australian Capital Territory | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (NSW) | GEOMETRYCOLLECTION EMPTY | 199999499 | No usual address (NSW) | 0 | No change | 19999 | No usual address (NSW) | 199 | No usual address (NSW) | 19499 | 1 | New South Wales | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (NT) | GEOMETRYCOLLECTION EMPTY | 799999499 | No usual address (NT) | 0 | No change | 79999 | No usual address (NT) | 799 | No usual address (NT) | 79499 | 7 | Northern Territory | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (OT) | GEOMETRYCOLLECTION EMPTY | 999999499 | No usual address (OT) | 0 | No change | 99999 | No usual address (OT) | 999 | No usual address (OT) | 99499 | 9 | Other Territories | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (Qld) | GEOMETRYCOLLECTION EMPTY | 399999499 | No usual address (Qld) | 0 | No change | 39999 | No usual address (Qld) | 399 | No usual address (Qld) | 39499 | 3 | Queensland | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (SA) | GEOMETRYCOLLECTION EMPTY | 499999499 | No usual address (SA) | 0 | No change | 49999 | No usual address (SA) | 499 | No usual address (SA) | 49499 | 4 | South Australia | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (Tas.) | GEOMETRYCOLLECTION EMPTY | 699999499 | No usual address (Tas.) | 0 | No change | 69999 | No usual address (Tas.) | 699 | No usual address (Tas.) | 69499 | 6 | Tasmania | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (Vic.) | GEOMETRYCOLLECTION EMPTY | 299999499 | No usual address (Vic.) | 0 | No change | 29999 | No usual address (Vic.) | 299 | No usual address (Vic.) | 29499 | 2 | Victoria | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| No usual address (WA) | GEOMETRYCOLLECTION EMPTY | 599999499 | No usual address (WA) | 0 | No change | 59999 | No usual address (WA) | 599 | No usual address (WA) | 59499 | 5 | Western Australia | AUS | Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Other Territories | MULTIPOLYGON (((96.84197 -12.20351, 96.84194 -... | 901011001 | Christmas Island | 0 | No change | 90101 | Christmas Island | 901 | Other Territories | 9OTER | 9 | Other Territories | AUS | Australia | 136.1356 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Outside Australia | GEOMETRYCOLLECTION EMPTY | ZZZZZZZZZ | Outside Australia | 1 | New | ZZZZZ | Outside Australia | ZZZ | Outside Australia | ZZZZZ | Z | Outside Australia | ZZZ | Outside Australia | NaN | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Rest of NSW | MULTIPOLYGON (((148.2009 -36.7987, 148.20071 -... | 101021007 | Braidwood | 0 | No change | 10102 | Queanbeyan | 101 | Capital Region | 1RNSW | 1 | New South Wales | AUS | Australia | 3418.3525 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Rest of NT | MULTIPOLYGON (((129.00049 -19.10636, 129.00049... | 702011045 | Charles | 0 | No change | 70201 | Alice Springs | 702 | Northern Territory - Outback | 7RNTE | 7 | Northern Territory | AUS | Australia | 16.6930 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Rest of Qld | MULTIPOLYGON (((137.99782 -22.32158, 137.99781... | 306011138 | Brinsmead | 0 | No change | 30601 | Cairns - North | 306 | Cairns | 3RQLD | 3 | Queensland | AUS | Australia | 5.1185 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Rest of SA | MULTIPOLYGON (((133.13148 -32.64558, 133.13161... | 405011110 | Barossa - Angaston | 0 | No change | 40501 | Barossa | 405 | Barossa - Yorke - Mid North | 4RSAU | 4 | South Australia | AUS | Australia | 633.8622 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Rest of Tas. | MULTIPOLYGON (((143.89013 -40.12266, 143.89007... | 602011036 | Invermay | 0 | No change | 60201 | Launceston | 602 | Launceston and North East | 6RTAS | 6 | Tasmania | AUS | Australia | 4.0281 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Rest of Vic. | MULTIPOLYGON (((143.1073 -38.66842, 143.10729 ... | 201011001 | Alfredton | 0 | No change | 20101 | Ballarat | 201 | Ballarat | 2RVIC | 2 | Victoria | AUS | Australia | 52.7109 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
| Rest of WA | MULTIPOLYGON (((113.96067 -28.986, 113.96119 -... | 501011001 | Augusta | 0 | No change | 50101 | Augusta - Margaret River - Busselton | 501 | Bunbury | 5RWAU | 5 | Western Australia | AUS | Australia | 2106.5915 | http://linked.data.gov.au/dataset/asgsed3/SA2/... |
Australia_adm1_diss.drop(columns=['STE_CODE21','STE_NAME21','AREASQKM21','LOCI_URI21','CHG_LBL21','CHG_FLAG21'],inplace=True) #eliminar columnas no importantes
Australia_adm1_diss.reset_index(inplace=True)
Australia_adm1_diss.info()
<class 'geopandas.geodataframe.GeoDataFrame'> RangeIndex: 35 entries, 0 to 34 Data columns (total 11 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 GCC_NAME21 35 non-null object 1 geometry 35 non-null geometry 2 SA2_CODE21 35 non-null object 3 SA2_NAME21 35 non-null object 4 SA3_CODE21 35 non-null object 5 SA3_NAME21 35 non-null object 6 SA4_CODE21 35 non-null object 7 SA4_NAME21 35 non-null object 8 GCC_CODE21 35 non-null object 9 AUS_CODE21 35 non-null object 10 AUS_NAME21 35 non-null object dtypes: geometry(1), object(10) memory usage: 3.1+ KB
linkWorldMap="https://github.com/valcc01/Trabajo-grupal-2/raw/refs/heads/main/GEODATA/wordlMaps%20(1).gpkg"
import geopandas as gpd
from fiona import listlayers
listlayers(linkWorldMap)
['indicators']
indicators=gpd.read_file(linkWorldMap,layer='indicators')
indicators.head() #Los países están dentro de regiones
| COUNTRY | Officialstatename | InternetccTLD | iso2 | iso3 | fragility_date | fragility | co2 | co2_date | region | ForestRev_gdp | ForestRev_date | co2_Qt | co2_Qt_jc5 | co2_Qt_jc5_cat | geometry | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | ANTIGUA AND BARBUDA | Antigua and Barbuda | .ag | AG | ATG | 2019.0 | 54.4 | 729000.0 | 2019.0 | CENTRAL AMERICA AND THE CARIBBEAN | 0.00 | 2018.0 | -1.463721 | 0 | 0_Very_low | MULTIPOLYGON (((-61.73889 17.54055, -61.75195 ... |
| 1 | AFGHANISTAN | The Islamic Republic of Afghanistan | .af | AF | AFG | 2019.0 | 105.0 | 7893000.0 | 2019.0 | SOUTH ASIA | 0.20 | 2018.0 | -0.315001 | 1 | 1_Low | MULTIPOLYGON (((61.27656 35.60725, 61.29638 35... |
| 2 | ALGERIA | The People's Democratic Republic of Algeria | .dz | DZ | DZA | 2019.0 | 75.4 | 151633000.0 | 2019.0 | AFRICA | 0.10 | 2018.0 | 0.875838 | 3 | 3_High | MULTIPOLYGON (((-5.15213 30.18047, -5.13917 30... |
| 3 | AZERBAIJAN | The Republic of Azerbaijan | .az | AZ | AZE | 2019.0 | 73.2 | 35389000.0 | 2019.0 | MIDDLE EAST | 0.02 | 2018.0 | 0.263211 | 2 | 2_Neutral | MULTIPOLYGON (((46.54037 38.87559, 46.49554 38... |
| 4 | ALBANIA | The Republic of Albania | .al | AL | ALB | 2019.0 | 58.9 | 3794000.0 | 2019.0 | EUROPE | 0.18 | 2018.0 | -0.766820 | 1 | 1_Low | MULTIPOLYGON (((20.79192 40.43154, 20.78722 40... |
indicators.dissolve(
by="region",
aggfunc={
"COUNTRY": "count",
"fragility": ["mean"],
"co2": ["mean"],
"ForestRev_gdp": ["mean"]
},as_index=False,
) #sacar información por región (bloques de países), ya no por países. Los números resultado son los promedios de los países de la región
| region | geometry | (COUNTRY, count) | (fragility, mean) | (co2, mean) | (ForestRev_gdp, mean) | |
|---|---|---|---|---|---|---|
| 0 | AFRICA | MULTIPOLYGON (((6.53361 0.34389, 6.61778 0.403... | 49 | 85.922449 | 1.712743e+07 | 3.322653 |
| 1 | AUSTRALIA AND OCEANIA | MULTIPOLYGON (((-176.51779 -43.90778, -176.532... | 6 | 55.100000 | 7.679500e+07 | 3.630000 |
| 2 | CENTRAL AMERICA AND THE CARIBBEAN | MULTIPOLYGON (((-81.71556 7.44681, -81.71362 7... | 16 | 62.993750 | 1.104856e+07 | 0.359375 |
| 3 | CENTRAL ASIA | MULTIPOLYGON (((50.03472 45.04833, 50.0425 45.... | 6 | 72.883333 | 3.898807e+08 | 0.236667 |
| 4 | EAST AND SOUTHEAST ASIA | MULTIPOLYGON (((105.26361 -6.54472, 105.26138 ... | 14 | 62.592857 | 1.029426e+09 | 0.619286 |
| 5 | EUROPE | MULTIPOLYGON (((-18.13223 27.77264, -18.1132 2... | 38 | 40.421053 | 9.864395e+07 | 0.200000 |
| 6 | MIDDLE EAST | MULTIPOLYGON (((42.76819 14.06653, 42.7868 14.... | 16 | 71.756250 | 1.583754e+08 | 0.032500 |
| 7 | NORTH AMERICA | MULTIPOLYGON (((-155.211 20.00166, -155.18335 ... | 3 | 42.566667 | 2.073395e+09 | 0.073333 |
| 8 | SOUTH AMERICA | MULTIPOLYGON (((-74.93431 -51.85501, -74.93251... | 11 | 61.436364 | 8.613718e+07 | 1.064545 |
| 9 | SOUTH ASIA | MULTIPOLYGON (((73.10193 -0.58431, 73.09915 -0... | 8 | 83.975000 | 3.309434e+08 | 0.365000 |
indicatorsByRegion=indicators.dissolve(
by="region",
aggfunc={
"COUNTRY": "count",
"fragility": ["mean"],
"co2": ["mean"],
"ForestRev_gdp": ["mean"]
},as_index=False,
)
indicatorsByRegion.plot(column = 'region')
<Axes: >
!pip install mapclassify>=2.4.0
indicatorsByRegion.plot(column =('fragility', 'mean'),scheme='quantiles', cmap='OrRd',
legend=True,
legend_kwds={"title": "Fragility",'loc': 'lower left'},
edgecolor='black',linewidth=0.2,
figsize=(15, 10))
<Axes: >
australia.centroid
<ipython-input-583-a2fa2a7b088b>:1: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation. australia.centroid
| 0 | |
|---|---|
| 11 | POINT (134.48956 -25.73497) |
australia.centroid.x.values[0],australia.centroid.y.values[0]
<ipython-input-584-3de27570ed90>:1: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation. australia.centroid.x.values[0],australia.centroid.y.values[0]
(134.48956278242508, -25.734968546496415)
airports_3112=gpd.read_file(LinkAustralia,layer='airports')
airports_3112.head()
| name | kind | latitude_deg | longitude_deg | elevation_ft | region_name | municipality | geometry | |
|---|---|---|---|---|---|---|---|---|
| 0 | Melbourne International Airport | large_airport | -37.673302 | 144.843002 | 434.0 | Victoria | Melbourne | POINT (960390.027 -4278051.009) |
| 1 | Brisbane International Airport | large_airport | -27.384199 | 153.117004 | 13.0 | Queensland | Brisbane | POINT (1860613.688 -3244612.198) |
| 2 | Perth International Airport | large_airport | -31.940300 | 115.967003 | 67.0 | Western Australia | Perth | POINT (-1684432.427 -3723348.148) |
| 3 | Cairns International Airport | medium_airport | -16.885799 | 145.755005 | 10.0 | Queensland | Cairns | POINT (1254634.549 -2007416.843) |
| 4 | Adelaide International Airport | large_airport | -34.947512 | 138.533393 | 20.0 | South Australia | Adelaide | POINT (412864.26 -3941270.535) |
# coordinates
centroidX,centroidY=australia.centroid.x.values[0],australia.centroid.y.values[0]
# subsets of medium airports
australia_AirTopLeft=airports_3112[airports_3112.kind=='medium_airport'].cx[:centroidX,centroidY:]
australia_AirTopRight=airports_3112[airports_3112.kind=='medium_airport'].cx[centroidX:,centroidY:]
australia_AirBottomLeft=airports_3112[airports_3112.kind=='medium_airport'].cx[:centroidX,:centroidY]
australia_AirBottomRight=airports_3112[airports_3112.kind=='medium_airport'].cx[centroidX:,:centroidY]
<ipython-input-586-81b07db9b514>:2: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation. centroidX,centroidY=australia.centroid.x.values[0],australia.centroid.y.values[0]
base=australia_AirTopLeft.plot(facecolor='grey', alpha=0.4)
australia_AirTopRight.plot(ax=base,facecolor='orange', alpha=0.4)
australia_AirBottomLeft.plot(ax=base,facecolor='green', alpha=0.4)
australia_AirBottomRight.plot(ax=base,facecolor='red', alpha=0.4)
<ipython-input-587-9a1aad33cd3a>:1: UserWarning: The GeoDataFrame you are attempting to plot is empty. Nothing has been displayed. base=australia_AirTopLeft.plot(facecolor='grey', alpha=0.4)
<Axes: >
australia_AirBottomLeft
| name | kind | latitude_deg | longitude_deg | elevation_ft | region_name | municipality | geometry | |
|---|---|---|---|---|---|---|---|---|
| 9 | Alice Springs Airport | medium_airport | -23.806588 | 133.903427 | 1789.0 | Northern Territory | Alice Springs | POINT (-9736.561 -2711146.742) |
| 12 | Ayers Rock Connellan Airport | medium_airport | -25.185913 | 130.977030 | 1626.0 | Northern Territory | Yulara | POINT (-301115.146 -2865834.22) |
| 19 | Perth Jandakot Airport | medium_airport | -32.097500 | 115.880997 | 99.0 | Western Australia | Perth | POINT (-1689927.529 -3741605.826) |
| 21 | Broome International Airport | medium_airport | -17.948789 | 122.227407 | 56.0 | Western Australia | Broome | POINT (-1245483.771 -2124912.278) |
| 32 | Kalgoorlie Boulder Airport | medium_airport | -30.791543 | 121.464586 | 1203.0 | Western Australia | Broadwood | POINT (-1185556.007 -3535306.304) |
| 42 | Albany Airport | medium_airport | -34.943298 | 117.808998 | 233.0 | Western Australia | Albany | POINT (-1470846.661 -4028237.256) |
| 44 | Geraldton Airport | medium_airport | -28.796101 | 114.707001 | 121.0 | Western Australia | Geraldton | POINT (-1853971.262 -3399988.28) |
| 51 | Karratha Airport | medium_airport | -20.712200 | 116.773003 | 29.0 | Western Australia | Karratha | POINT (-1777823.909 -2493492.308) |
| 52 | East Kimberley Regional (Kununurra) Airport | medium_airport | -15.778100 | 128.707993 | 145.0 | Western Australia | Kununurra | POINT (-570669.121 -1837532.818) |
| 54 | Tindal Airport | medium_airport | -14.521100 | 132.378006 | 443.0 | Northern Territory | None | POINT (-176767.278 -1686336.581) |
| 69 | Port Hedland International Airport | medium_airport | -20.377800 | 118.625999 | 33.0 | Western Australia | Port Hedland | POINT (-1592099.07 -2432151.014) |
| 78 | Learmonth Airport | medium_airport | -22.235201 | 114.090024 | 19.0 | Western Australia | Exmouth | POINT (-2026139.735 -2699650.574) |
| 82 | Paraburdoo Airport | medium_airport | -23.171101 | 117.745003 | 1406.0 | Western Australia | Paraburdoo | POINT (-1643259.763 -2747908.983) |
| 98 | Meekatharra Airport | medium_airport | -26.611700 | 118.547997 | 1713.0 | Western Australia | None | POINT (-1516291.737 -3111609.802) |
| 101 | Ceduna Airport | medium_airport | -32.130600 | 133.710007 | 77.0 | South Australia | None | POINT (-27132.675 -3623240.035) |
| 102 | Carnarvon Airport | medium_airport | -24.880091 | 113.670752 | 13.0 | Western Australia | Carnarvon | POINT (-2021744.237 -2992610.184) |
| 104 | Esperance Airport | medium_airport | -33.684399 | 121.822998 | 470.0 | Western Australia | Esperance | POINT (-1120984.67 -3848657.149) |
| 134 | RAAF Base Pearce | medium_airport | -31.667801 | 116.014999 | 149.0 | Western Australia | Bullsbrook | POINT (-1684250.86 -3693065.706) |
| 135 | Forrest Airport | medium_airport | -30.836620 | 128.112811 | 511.0 | Western Australia | None | POINT (-557278.7 -3494131.108) |
| 167 | Newman Airport | medium_airport | -23.417801 | 119.803001 | 1724.0 | Western Australia | Newman | POINT (-1433112.898 -2749567.798) |
| 168 | Snake Bay Airport | medium_airport | -11.417674 | 130.648481 | 173.0 | Northern Territory | Milikapiti | POINT (-374534.615 -1340891.253) |
| 175 | Telfer Airport | medium_airport | -21.715000 | 122.228996 | 970.0 | Western Australia | None | POINT (-1206487.014 -2538236.653) |
| 178 | RAAF Base Curtin | medium_airport | -17.580458 | 123.828449 | 300.0 | Western Australia | Derby | POINT (-1079798.501 -2069462.521) |
| 218 | Mount Magnet Airport | medium_airport | -28.116100 | 117.842003 | 1354.0 | Western Australia | None | POINT (-1564083.291 -3283627.026) |
| 225 | Shark Bay Airport | medium_airport | -25.897294 | 113.575802 | 111.0 | Western Australia | Denham | POINT (-2013085.922 -3104029.226) |
| 227 | Leonora Airport | medium_airport | -28.878099 | 121.315002 | 1217.0 | Western Australia | Leonora | POINT (-1220791.166 -3328042.874) |
| 236 | Derby Airport | medium_airport | -17.371930 | 123.662210 | 24.0 | Western Australia | Derby | POINT (-1099305.78 -2047868.62) |
| 241 | Port Keats Airport | medium_airport | -14.249701 | 129.529538 | 91.0 | Northern Territory | Wadeye | POINT (-488188.64 -1663502.355) |
| 243 | Bathurst Island Airport | medium_airport | -11.764966 | 130.615774 | 67.0 | Northern Territory | Wurrumiyanga | POINT (-377130.222 -1380288.092) |
| 342 | Leinster Airport | medium_airport | -27.843300 | 120.703003 | 1631.0 | Western Australia | None | POINT (-1291440.628 -3221460.127) |
| 343 | Wiluna Airport | medium_airport | -26.629200 | 120.221001 | 1649.0 | Western Australia | None | POINT (-1352610.329 -3094415.689) |
| 360 | Fitzroy Crossing Airport | medium_airport | -18.183596 | 125.559783 | 368.0 | Western Australia | None | POINT (-891825.812 -2122475.943) |
| 361 | Halls Creek Airport | medium_airport | -18.233900 | 127.669998 | 1346.0 | Western Australia | None | POINT (-668792.287 -2114928.335) |
| 362 | Mount Keith Airport | medium_airport | -27.287330 | 120.554937 | 1792.0 | Western Australia | None | POINT (-1312264.85 -3162482.712) |
| 363 | Eliwana | medium_airport | -22.428395 | 116.887879 | 1576.0 | Western Australia | None | POINT (-1740444.933 -2678696.057) |
| 364 | Garden Point Airport | medium_airport | -11.399686 | 130.425568 | 90.0 | Northern Territory | Pirlangimpi | POINT (-399496.747 -1339540.62) |
australia_AirBottomLeft.convex_hull.plot()
<Axes: >
australia_AirBottomLeft.dissolve().convex_hull.plot()
<Axes: >
australia_AirBottomLeft.dissolve().convex_hull
| 0 | |
|---|---|
| 0 | POLYGON ((-1470846.661 -4028237.256, -1689927.... |
australia_municipalities.cx[:centroidX,:centroidY].convex_hull.plot(edgecolor='red')
<Axes: >
large_airport=airports_3112[airports_3112.kind=='large_airport']
large_airport.union_all()
large_airport.union_all().convex_hull
LargeAirport_hull= gpd.GeoDataFrame(index=[0],
crs=large_airport.crs,
geometry=[large_airport.union_all().convex_hull])
LargeAirport_hull['name']='large airports hull' # optional
# then
LargeAirport_hull
| geometry | name | |
|---|---|---|
| 0 | POLYGON ((960390.027 -4278051.009, -1684432.42... | large airports hull |
base=australia_3112.plot(facecolor='yellow')
large_airport.plot(ax=base)
LargeAirport_hull.plot(ax=base,facecolor='green',
edgecolor='white',alpha=0.4,
hatch='X')
<Axes: >
MunisN_australia=australia_municipalities.cx[:,centroidY:]
# the south
MunisS_australia=australia_municipalities.cx[:,:centroidY]
# the west
MunisW_australia=australia_municipalities.cx[:centroidX,:]
# the east
MunisE_australia=australia_municipalities.cx[centroidX:,:]
base=MunisN_australia.plot(facecolor='yellow', edgecolor='black',linewidth=0.2, alpha=0.6)
MunisS_australia.plot(facecolor='grey', edgecolor='black',linewidth=0.2,ax=base, alpha=0.4)
<Axes: >
base=MunisE_australia.plot(facecolor='yellow', edgecolor='black',linewidth=0.2, alpha=0.6)
MunisW_australia.plot(facecolor='grey', edgecolor='black',linewidth=0.2,ax=base, alpha=0.4)
<Axes: >
munisNS_australia=MunisN_australia.overlay(MunisS_australia, how="intersection",keep_geom_type=True)
munisNS_australia.plot()
<Axes: >
MunisN_australia.sjoin(MunisS_australia, how="inner", predicate='contains').plot()
<Axes: >
munisWE_australia=MunisW_australia.overlay(MunisE_australia, how="intersection",keep_geom_type=True)
munisWE_australia.plot(edgecolor='white',linewidth=0.1)
<Axes: >
munisNS_australia.info()
<class 'geopandas.geodataframe.GeoDataFrame'> RangeIndex: 15 entries, 0 to 14 Data columns (total 33 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 SA2_CODE21_1 15 non-null object 1 SA2_NAME21_1 15 non-null object 2 CHG_FLAG21_1 15 non-null object 3 CHG_LBL21_1 15 non-null object 4 SA3_CODE21_1 15 non-null object 5 SA3_NAME21_1 15 non-null object 6 SA4_CODE21_1 15 non-null object 7 SA4_NAME21_1 15 non-null object 8 GCC_CODE21_1 15 non-null object 9 GCC_NAME21_1 15 non-null object 10 STE_CODE21_1 15 non-null object 11 STE_NAME21_1 15 non-null object 12 AUS_CODE21_1 15 non-null object 13 AUS_NAME21_1 15 non-null object 14 AREASQKM21_1 15 non-null float64 15 LOCI_URI21_1 15 non-null object 16 SA2_CODE21_2 15 non-null object 17 SA2_NAME21_2 15 non-null object 18 CHG_FLAG21_2 15 non-null object 19 CHG_LBL21_2 15 non-null object 20 SA3_CODE21_2 15 non-null object 21 SA3_NAME21_2 15 non-null object 22 SA4_CODE21_2 15 non-null object 23 SA4_NAME21_2 15 non-null object 24 GCC_CODE21_2 15 non-null object 25 GCC_NAME21_2 15 non-null object 26 STE_CODE21_2 15 non-null object 27 STE_NAME21_2 15 non-null object 28 AUS_CODE21_2 15 non-null object 29 AUS_NAME21_2 15 non-null object 30 AREASQKM21_2 15 non-null float64 31 LOCI_URI21_2 15 non-null object 32 geometry 15 non-null geometry dtypes: float64(2), geometry(1), object(30) memory usage: 4.0+ KB
munisWE_australia.info()
<class 'geopandas.geodataframe.GeoDataFrame'> RangeIndex: 10 entries, 0 to 9 Data columns (total 33 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 SA2_CODE21_1 10 non-null object 1 SA2_NAME21_1 10 non-null object 2 CHG_FLAG21_1 10 non-null object 3 CHG_LBL21_1 10 non-null object 4 SA3_CODE21_1 10 non-null object 5 SA3_NAME21_1 10 non-null object 6 SA4_CODE21_1 10 non-null object 7 SA4_NAME21_1 10 non-null object 8 GCC_CODE21_1 10 non-null object 9 GCC_NAME21_1 10 non-null object 10 STE_CODE21_1 10 non-null object 11 STE_NAME21_1 10 non-null object 12 AUS_CODE21_1 10 non-null object 13 AUS_NAME21_1 10 non-null object 14 AREASQKM21_1 10 non-null float64 15 LOCI_URI21_1 10 non-null object 16 SA2_CODE21_2 10 non-null object 17 SA2_NAME21_2 10 non-null object 18 CHG_FLAG21_2 10 non-null object 19 CHG_LBL21_2 10 non-null object 20 SA3_CODE21_2 10 non-null object 21 SA3_NAME21_2 10 non-null object 22 SA4_CODE21_2 10 non-null object 23 SA4_NAME21_2 10 non-null object 24 GCC_CODE21_2 10 non-null object 25 GCC_NAME21_2 10 non-null object 26 STE_CODE21_2 10 non-null object 27 STE_NAME21_2 10 non-null object 28 AUS_CODE21_2 10 non-null object 29 AUS_NAME21_2 10 non-null object 30 AREASQKM21_2 10 non-null float64 31 LOCI_URI21_2 10 non-null object 32 geometry 10 non-null geometry dtypes: float64(2), geometry(1), object(30) memory usage: 2.7+ KB
keep=['SA4_NAME21_1','GCC_NAME21_1','STE_NAME21_1','AUS_NAME21_1','geometry']
munisNS_australia=munisNS_australia.loc[:,keep]
munisWE_australia=munisWE_australia.loc[:,keep]
munisNS_australia.overlay(munisWE_australia,how="union",keep_geom_type=True)
| SA4_NAME21_1_1 | GCC_NAME21_1_1 | STE_NAME21_1_1 | AUS_NAME21_1_1 | SA4_NAME21_1_2 | GCC_NAME21_1_2 | STE_NAME21_1_2 | AUS_NAME21_1_2 | geometry | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((129.00078 -24.13743, 129.25132 -24.1... |
| 1 | Darling Downs - Maranoa | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((150.42507 -26.56338, 150.42888 -26.5... |
| 2 | Darling Downs - Maranoa | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((147.45136 -26.08131, 147.44837 -26.0... |
| 3 | Central Queensland | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((150.05143 -23.90006, 150.05251 -23.8... |
| 4 | Queensland - Outback | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((144.81632 -23.0025, 144.8148 -23.002... |
| 5 | Queensland - Outback | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((145.29468 -26.19908, 145.29488 -26.1... |
| 6 | Queensland - Outback | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((137.99791 -22.45233, 137.99787 -22.3... |
| 7 | Queensland - Outback | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((141.82656 -26.74667, 141.82612 -26.7... |
| 8 | Wide Bay | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((150.93522 -25.58579, 150.93548 -25.5... |
| 9 | Wide Bay | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | POLYGON ((150.60109 -24.81707, 150.6035 -24.80... |
| 10 | Wide Bay | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | MULTIPOLYGON (((152.95493 -25.63221, 152.95492... |
| 11 | Wide Bay | Rest of Qld | Queensland | Australia | NaN | NaN | NaN | NaN | MULTIPOLYGON (((152.95949 -25.48777, 152.95855... |
| 12 | Western Australia - Outback (South) | Rest of WA | Western Australia | Australia | NaN | NaN | NaN | NaN | MULTIPOLYGON (((114.35646 -22.4875, 114.3567 -... |
| 13 | Western Australia - Outback (South) | Rest of WA | Western Australia | Australia | NaN | NaN | NaN | NaN | POLYGON ((120.04506 -28.35392, 120.04499 -28.2... |
| 14 | Western Australia - Outback (South) | Rest of WA | Western Australia | Australia | NaN | NaN | NaN | NaN | POLYGON ((117.24703 -25.60741, 117.26124 -25.6... |
| 15 | NaN | NaN | NaN | NaN | South Australia - Outback | Rest of SA | South Australia | Australia | MULTIPOLYGON (((134.24153 -34.00885, 134.24154... |
| 16 | NaN | NaN | NaN | NaN | South Australia - Outback | Rest of SA | South Australia | Australia | MULTIPOLYGON (((133.33972 -32.36898, 133.33971... |
| 17 | NaN | NaN | NaN | NaN | South Australia - Outback | Rest of SA | South Australia | Australia | POLYGON ((133.47821 -27.84202, 133.67531 -27.8... |
| 18 | NaN | NaN | NaN | NaN | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((134.12248 -23.03103, 134.12228 -22.9... |
| 19 | NaN | NaN | NaN | NaN | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((134.12229 -22.57049, 134.12236 -22.7... |
| 20 | NaN | NaN | NaN | NaN | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((132.40206 -16.75683, 132.40205 -16.7... |
| 21 | NaN | NaN | NaN | NaN | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | MULTIPOLYGON (((132.99049 -11.07454, 132.99087... |
| 22 | NaN | NaN | NaN | NaN | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((132.36525 -13.80848, 132.48106 -13.8... |
| 23 | NaN | NaN | NaN | NaN | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | MULTIPOLYGON (((136.94986 -15.50344, 136.94951... |
import pandas as pd
pd.concat([munisNS_australia,munisWE_australia],ignore_index=True)
| SA4_NAME21_1 | GCC_NAME21_1 | STE_NAME21_1 | AUS_NAME21_1 | geometry | |
|---|---|---|---|---|---|
| 0 | Darling Downs - Maranoa | Rest of Qld | Queensland | Australia | POLYGON ((150.42507 -26.56338, 150.42888 -26.5... |
| 1 | Darling Downs - Maranoa | Rest of Qld | Queensland | Australia | POLYGON ((147.45136 -26.08131, 147.44837 -26.0... |
| 2 | Central Queensland | Rest of Qld | Queensland | Australia | POLYGON ((150.05143 -23.90006, 150.05251 -23.8... |
| 3 | Queensland - Outback | Rest of Qld | Queensland | Australia | POLYGON ((144.81632 -23.0025, 144.8148 -23.002... |
| 4 | Queensland - Outback | Rest of Qld | Queensland | Australia | POLYGON ((145.29468 -26.19908, 145.29488 -26.1... |
| 5 | Queensland - Outback | Rest of Qld | Queensland | Australia | POLYGON ((137.99802 -22.75723, 137.99803 -22.7... |
| 6 | Queensland - Outback | Rest of Qld | Queensland | Australia | POLYGON ((141.82645 -26.74708, 141.82656 -26.7... |
| 7 | Wide Bay | Rest of Qld | Queensland | Australia | POLYGON ((150.93522 -25.58579, 150.93548 -25.5... |
| 8 | Wide Bay | Rest of Qld | Queensland | Australia | POLYGON ((150.60109 -24.81707, 150.6035 -24.80... |
| 9 | Wide Bay | Rest of Qld | Queensland | Australia | MULTIPOLYGON (((152.95493 -25.63221, 152.95492... |
| 10 | Wide Bay | Rest of Qld | Queensland | Australia | MULTIPOLYGON (((152.95949 -25.48777, 152.95855... |
| 11 | Western Australia - Outback (South) | Rest of WA | Western Australia | Australia | MULTIPOLYGON (((114.35646 -22.4875, 114.3567 -... |
| 12 | Western Australia - Outback (South) | Rest of WA | Western Australia | Australia | POLYGON ((120.0452 -28.46156, 120.04506 -28.35... |
| 13 | Western Australia - Outback (South) | Rest of WA | Western Australia | Australia | POLYGON ((117.24703 -25.60741, 117.26124 -25.6... |
| 14 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((129.00055 -24.13744, 129.00078 -24.1... |
| 15 | South Australia - Outback | Rest of SA | South Australia | Australia | MULTIPOLYGON (((134.24153 -34.00885, 134.24154... |
| 16 | South Australia - Outback | Rest of SA | South Australia | Australia | MULTIPOLYGON (((133.33972 -32.36898, 133.33971... |
| 17 | South Australia - Outback | Rest of SA | South Australia | Australia | POLYGON ((133.8354 -28.07494, 133.35877 -28.06... |
| 18 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((129.00055 -24.13744, 129.00078 -24.1... |
| 19 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((134.12568 -23.07219, 134.12555 -23.0... |
| 20 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((134.12229 -22.57049, 134.12236 -22.7... |
| 21 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((132.40207 -17.03327, 132.40206 -16.7... |
| 22 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | MULTIPOLYGON (((132.99049 -11.07454, 132.99087... |
| 23 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | POLYGON ((132.36525 -13.80848, 132.48106 -13.8... |
| 24 | Northern Territory - Outback | Rest of NT | Northern Territory | Australia | MULTIPOLYGON (((136.94986 -15.50344, 136.94951... |
munisNS_australia.dissolve().overlay(munisWE_australia.dissolve(), how="union",keep_geom_type=True).dissolve().plot()
<Axes: >
muniMidaustralia=munisNS_australia.dissolve().overlay(munisWE_australia.dissolve(), how="union",keep_geom_type=True).dissolve()
muniMidaustralia #GUARDAMOS EL CRUCE DEL CENTRO
| geometry | SA4_NAME21_1_1 | GCC_NAME21_1_1 | STE_NAME21_1_1 | AUS_NAME21_1_1 | SA4_NAME21_1_2 | GCC_NAME21_1_2 | STE_NAME21_1_2 | AUS_NAME21_1_2 | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | MULTIPOLYGON (((113.66599 -26.66012, 113.667 -... | Darling Downs - Maranoa | Rest of Qld | Queensland | Australia | South Australia - Outback | Rest of SA | South Australia | Australia |
muniMidaustralia['zone']='middles'
muniMidaustralia=muniMidaustralia.loc[:,['AUS_NAME21_1_1','zone','geometry']]
muniMidaustralia
| AUS_NAME21_1_1 | zone | geometry | |
|---|---|---|---|
| 0 | Australia | middles | MULTIPOLYGON (((113.66599 -26.66012, 113.667 -... |
australia_municipalities.overlay(muniMidaustralia, how='difference').plot()
/usr/local/lib/python3.10/dist-packages/geopandas/geodataframe.py:2675: UserWarning: `keep_geom_type=True` in overlay resulted in 19 dropped geometries of different geometry types than df1 has. Set `keep_geom_type=False` to retain all geometries return geopandas.overlay(
<Axes: >
MunisN_australia.overlay(MunisS_australia, how="symmetric_difference",keep_geom_type=False).plot()
<Axes: >
MunisW_australia.overlay(MunisE_australia, how="symmetric_difference",keep_geom_type=False).plot()
<Axes: >